<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="bootstrap/css/bootstrap.css" />
<link rel="stylesheet" href="bootstrap/css/style.css" />
<script type="text/javascript" src="bootstrap/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.js"></script>
<title>Permissions Page</title>
<%
	int counter = 1;
%>
</head>
<body>

	<div class="row">
		<div class="col-lg-12">
			<div class="panel panel-success">
				<div class="panel-heading">
					<h4>Permissions</h4>
				</div>
				<div class="panel-body">
					<div class="row">
						<ul class="nav nav-pills">
							<li class="active"><a href="./ShowPermissionsServlet">Permissions</a></li>
							<li><a href="./ShowRolesServlet">Roles</a></li>
						</ul>
					</div>
					
					<center>
						<img src="bootstrap/images/logo_ibm.png" width="90" height="50">
					</center>
					<hr>
					<a class="btn btn-success" href="permission.jsp?op=add">Add
						Permission</a>
					<div class="table-responsive" style="margin-top: 3%;">
						<table class="table" border="1">
							<tr>
								<th>ID</th>
								<th>Name</th>
								<th>Description</th>
								<th colspan="2"><center>Options</center></th>
							</tr>
							<c:forEach items="${perms}" var="perm">
								<tr>
									<td><%=counter++%></td>
									<td><c:out value="${perm.name}"></c:out></td>
									<td><c:out value="${perm.description}"></c:out></td>
									<c:if test = "${perm.assigned == true}">
										<td>Yes</td>	
									</c:if>
									<c:if test = "${perm.assigned == false}">
										<td>No</td>	
									</c:if>
									<td><a type="button" class="btn btn-info"
										href="permission.jsp?op=edit&id=${perm.id}&name=${perm.name}&desc=${perm.description}">Edit</a></td>
									<td><a type="button" class="btn btn-warning"
										href="permission.jsp?op=delete&id=${perm.id}&name=${perm.name}&desc=${perm.description}">Delete</a></td>
								</tr>
							</c:forEach>
						</table>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>